<section class='memory' ng:controller='Top.Game.Memory as Memory'>
<div class='memory-controls'>
<md-button class='md-primary md-hue-1' ng-class="{'md-raised': Memory.active == 'main'}" ng-click="Memory.switchTo('main')" tooltip-placement='right' uib-tooltip-html="'Main&amp;nbsp;memory' | trust">
<i class='fa fa-database'></i>
</md-button>
<md-button class='md-primary md-hue-1' ng-class="{'md-raised': Memory.active == 'segments'}" ng-click="Memory.switchTo('segments')" tooltip-placement='right' uib-tooltip='Segments'>
<i class='fa fa-th'></i>
</md-button>
</div>
<div ng:controller='Top.Game.Memory.Main as MemoryMain'>
<div class='memory-content memory-content--main' ng-if="Memory.active == 'main'">
<div class='memory-watches-container'>
<div class='memory-watch' ng:class="{'memory-root-watch': !watch.path, 'memory-selected-object-watch': watch.path == MemoryMain.selectedObjectWatch}" ng:controller='Top.Game.Memory.Main.MemoryWatch as MemoryWatch' ng:repeat='watch in MemoryMain.watches | orderBy:MemoryMain.orderBy track by watch.path'>
<div class='memory-watch-expression'>
<span ng:if='watch.path'>{{watch.path}}</span>
<span ng:if='!watch.path'>Memory root</span>
<div class='memory-watch-remove fa fa-remove' ng:click='MemoryMain.removeWatch(watch.path)' ng:if='watch.path' tooltip-append-to-body='true' tooltip-placement='top' uib-tooltip='Remove watch'></div>
</div>
<div class='memory-watch-value' ng:click='MemoryWatch.getMemory()' ng:if='!MemoryWatch.editing &amp;&amp; !watch.path'>
<i class='fa fa-caret-right'></i>
<span>[object Object]</span>
</div>
<div class='memory-watch-value' ng:class="{incorrect: MemoryWatch.value == 'Incorrect memory path', 'value-loading': MemoryWatch.loading}" ng:click='MemoryWatch.getMemory()' ng:if='!MemoryWatch.editing &amp;&amp; watch.path'>
<i class='fa fa-caret-right' ng:if="MemoryWatch.value &amp;&amp; MemoryWatch.value != 'Incorrect memory path'"></i>
<span ng:if='MemoryWatch.value'>{{MemoryWatch.value}}</span>
<span ng:if='!MemoryWatch.value'>&nbsp;</span>
</div>
<div class='memory-watch-editing' ng:if='MemoryWatch.editing'>
<div class='editing-controls'>
<md:button app:click-animated='MemoryWatch.save()' class='md-primary md-hue-1' tooltip-append-to-body='true' tooltip-placement='top' uib-tooltip='Save'>
<div class='fa fa-check'></div>
</md:button>
<md:button app:click-animated='MemoryWatch.reload()' class='md-primary md-hue-1' tooltip-append-to-body='true' tooltip-placement='top' uib-tooltip='Reload'>
<div class='fa fa-refresh'></div>
</md:button>
<md:button class='md-primary md-hue-1' ng:click='MemoryWatch.cancel()' tooltip-append-to-body='true' tooltip-placement='top' uib-tooltip='Cancel changes'>
<div class='fa fa-close'></div>
</md:button>
<md:button app:click-animated='MemoryWatch.remove()' class='md-primary md-hue-1 watch-delete' ng:if='watch.path' tooltip-append-to-body='true' tooltip-placement='top' uib-tooltip='Delete from memory'>
<div class='fa fa-trash'></div>
<span ng:if='MemoryWatch.removeFirstTry'>Click again to confirm</span>
</md:button>
<div class='memory-size'>{{MemoryWatch.editingSize | number:1}} KB</div>
</div>
<div app:json-editor='{name: MemoryWatch.getLastPathPart()}' class='editor' editor-interface='MemoryWatch.editor' editor-json='MemoryWatch.editing'></div>
</div>
</div>
</div>
<form class='memory-watch memory-new-watch' ng:if='MemoryMain.watches.length &lt; 50' ng:submit='MemoryMain.submitNewWatch()'>
<input ng:model='MemoryMain.newWatchPath' placeholder='Add new memory watch path here, e.g. "creeps.John"' type='text'>
</form>
</div>
</div>
<div ng:controller='Top.Game.Memory.Segments as MemorySegments'>
<div class='memory-content memory-content--segments' ng-if="Memory.active == 'segments'">
<div class='memory-segment-controls' ng-class="{'memory-segment-controls--loading': MemorySegments.loading}">
<label>SEGMENT #:</label>
<select app-autofocus ng-change='MemorySegments.onChange()' ng-model='MemorySegments.activeSegment' ng-options='i for i in MemorySegments.segmentsList'></select>
<md-button class='md-primary md-hue-1' ng-click='MemorySegments.onChange()' ng-disabled='MemorySegments.activeSegment === null' title='Reload'>
<div class='fa fa-refresh'></div>
</md-button>
<md-button app:click-animated='MemorySegments.save()' class='md-primary md-hue-1' ng-disabled='MemorySegments.activeSegment === null || !MemorySegments.dirty' title='Save'>
<div class='fa fa-check'></div>
</md-button>
</div>
<textarea class='memory-segment-content' ng-change='MemorySegments.dirty = true' ng-model='MemorySegments.activeSegmentContent' placeholder='NO DATA'></textarea>
</div>
</div>
</section>
